<template>
	<view class="ys" :style="{'--bg':'url(/static/index/ibg.png)'}">
		<view class="list">
			<view class="item" v-for="(item,index) in list" :key="index"
				@click="toPage(`/pages/video/index?id=${item.id}`)">
				<image :src="item.cover_path" mode=""></image>
				<view class="info">
					<view class="title">
						{{item.studio_name}} <text>{{item.type.text}}</text>
					</view>
					<view class="phone">
						<uni-icons type="location-filled" color="#999"></uni-icons>
						{{item.address || '保密'}}
					</view>
					<view class="phone">
						<uni-icons type="phone-filled" color="#999"></uni-icons>
						{{item.user.phone}}
					</view>
					<view class="phone">
						<uni-icons type="medal-filled" color="#999"></uni-icons>
						成交单数：{{item.orders_count}}
					</view>
				</view>
				<!-- <uni-icons type="right" color="#999"></uni-icons> -->
			</view>
		</view>
	</view>
</template>

<script>
	import {
		train
	} from "@/api/api.js"
	export default {
		data() {
			return {
				list: [],
				page: 1,
				last_page: 1
			}
		},
		onShow() {
			this.page = 1
			this.last_page = 1
			this.list = []
			this.train()
		},
		methods: {
			train() {
				train({
					page: this.page
				}).then(res => {
					if (res.code == 0) {
						this.list = this.list.concat(res.data.data)
						this.last_page = res.data.last_page
					}
				})
			}
		}
	}
</script>

<style lang="scss">
	.ys {
		--bg: '';
		height: 100%;
		min-height: 100vh;
		/* #ifdef H5 */
		min-height: calc(100vh - 44px);
		/* #endif */
		padding: 0 0 10px 0;
		box-sizing: border-box;
		position: relative;
		background-color: #050B18;

		&::before {
			position: absolute;
			content: '';
			top: 0;
			left: 0;
			right: 0;
			bottom: 0;
			background-image: var(--bg);
			background-size: cover;
			opacity: .05;
		}
	}

	page {

		.list {
			padding: 10px;
			position: relative;
			z-index: 1;

			.item {
				border-radius: 8px;
				padding: 5px;
				background: #1F2430;
				display: flex;
				align-items: center;
				justify-content: space-between;
				margin-bottom: 8px;

				image {
					width: 90px;
					height: 90px;
					border-radius: 8px;
				}

				.info {
					padding: 0 10px;
					flex: 1;
					box-sizing: border-box;
					height: 100%;
					color: #fff;

					.title {
						font-weight: bold;
						font-size: 15px;
						margin-bottom: 7px;
						white-space: nowrap;
						overflow: hidden;
						text-overflow: ellipsis;

						text {
							font-size: 12px;
							font-weight: normal;
							padding: 2px 6px;
							border-radius: 4px;
							background: #E0C03F;
							color: #000;
							margin-left: 3px;
						}
					}

					.desc {
						font-size: 12px;
						color: #999;
						display: -webkit-box;
						-webkit-line-clamp: 2;
						-webkit-box-orient: vertical;
						overflow: hidden;
						margin-bottom: 5px;
					}

					.phone {
						font-size: 12px;
						color: #999;
						margin-bottom: 7px;
						display: flex;
						align-items: center;

						text {
							margin-right: 3px;
						}
					}

					.time {
						font-size: 12px;
						color: #999;
					}
				}
			}
		}
	}
</style>